<template>
  <u-popup :show="state.show"  bgColor="transparent" mode="center" @close="close" :closeable="true">
    <view class="rich-wapper">
		<!-- <view class="title-rich">
			{{state.title}}
		</view> -->
		<view class="content">
			<scroll-view scroll-y="true"  style="height:800rpx;">
				<u-parse :content="state.content"></u-parse>
			</scroll-view>
		</view>
		
    </view>
  </u-popup>
</template>

<script setup>
  import { computed, watch, ref, reactive, unref, nextTick ,onMounted} from 'vue';
  import LC from '@/LC';
  let props=defineProps(['node'])
 
  let state=reactive({
	  show:false,
	  content:'',
	  title:'',
	 
  })

onMounted(()=>{
	
	
})
  
  function close() {
    emit('close');
    state.show = false;
  }
  function open(op) {
	   state.show = true;
	  if(op?.id){
		 
		  state.title=op.title
	  }
   if(props.node){
   	state.title=props.node.title
   	state.content=props.node.rule
   	return 
   }
	init(op.id)
  }
  
  // async function richText(){
  // 	const res = await LC.$api.app.page('1001')
  // 	if (res.code == 1) {
  	
  // 			state.wxts=res.data.content
  // 	}
  // }
  async  function init(id=1001){
	  const res = await LC.$api.app.page(id)
	  if (res.code == 1) {
	  state.title=res.data.title
		state.content=res.data.content
	  }
	  
  }
  let emit = defineEmits(['open', 'close', 'success']);
  defineExpose({ close, open });
</script>

<style lang="scss" scoped>
.rich-wapper{
	width: 600rpx;
	height: 926rpx;
	background: #FFFFFF;
	padding:60rpx 44rpx;
	box-sizing: border-box;
	border-radius: 10rpx;
}
	
.content{
	padding:0 18rpx;
	margin-top: 31rpx;
}
.title-rich{
	font-family: PingFangSC, PingFang SC;
	font-weight: 500;
	font-size: 31rpx;
	color: #131313;
	line-height: 42rpx;
	text-align: center;
	
}
</style>
